#include "ST7789.h"
#include "image.h"
#include "songshu.h"
#include "ti_msp_dl_config.h"
int main(void) {
  SYSCFG_DL_init();
  DL_TimerA_startCounter(PWM_0_INST);
  DL_TimerG_setCaptureCompareValue(PWM_0_INST, 700, DL_TIMER_CC_0_INDEX);
  /* Set LED to indicate start of transfer */
  DL_GPIO_clearPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
  delay_cycles(16000000);
  DL_GPIO_setPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
  delay_cycles(16000000);
  DL_GPIO_clearPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
  delay_cycles(16000000);
  DL_GPIO_setPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
  delay_cycles(16000000);

  ips154_init();
  ips154_clear();
  delay_cycles(16000000);
  ips154_full(RGB565_RED);
  ips154_draw_line(30, 30, 180, 190, RGB565_BLUE);
  ips154_show_string(10, 50, "helloWorld");
  ips154_show_uint(10, 70, 215, 5);
  ips154_show_float(10, 90, 4.1415, 3, 3);
  ips154_draw_rectangle(50, 200, 150, 20, 1, RGB565_BLUE);
  ips154_draw_circle(150, 150, 20, 1, RGB565_LGRAY);
  ips154_draw_image(100, 10, 169, 79, gImage_70X70);
  ips154_draw_image(0, 0, 99, 99, gImage_songshu);
  /* After all data is transmitted, toggle LED */
  while (1) {
    ips154_clear();
    delay_cycles(16000000);
    ips154_full(RGB565_RED);
    ips154_draw_line(30, 30, 180, 190, RGB565_BLUE);
    ips154_show_string(10, 50, "helloWorld");
    ips154_show_uint(10, 70, 215, 5);
    ips154_show_float(10, 90, 4.1415, 3, 3);
    ips154_draw_rectangle(50, 200, 150, 20, 1, RGB565_BLUE);
    ips154_draw_circle(150, 150, 20, 1, RGB565_LGRAY);
    ips154_draw_image(100, 10, 169, 79, gImage_70X70);
    ips154_draw_image(0, 0, 99, 99, gImage_songshu);
    delay_cycles(16000000);
  }
}
